HAL CCB constants migration ¶
This section provides information about the HAL CCB constants migration .
HAL CCB AES algorithm mode ¶
|
HAL1 |
HAL2 |
|---|---|
#define CCB_AES_ECB
#define CCB_AES_CBC
|
typedef enum
{
HAL_CCB_AES_ECB
HAL_CCB_AES_CBC
} hal_ccb_aes_chaining_mode_t;
|
Related concepts:
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.
Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).
HAL CCB error constants ¶
Note
In HAL1 , only one error code was defined that is used for any possible operation error.
In HAL2, there are more granularity in the error description,providing each error code by a dedicated define.
|
HAL1 |
HAL2 |
|---|---|
#define HAL_CCB_ERROR_NONE
#define HAL_CCB_ERROR_OPERATION
#define HAL_CCB_ERROR_PKARAM_ERASE
#define HAL_CCB_ERROR_PKAREG_TAMP
#define HAL_CCB_ERROR_RNG_TAMP
#define HAL_CCB_ERROR_SAES_TAMP
#define HAL_CCB_ERROR_PKAOPR_TAMP
#define HAL_CCB_ERROR_INVALID_PARAM
|
#define HAL_CCB_ERROR_NONE
#define HAL_CCB_ERROR_CCB_RCC_RESET
#define HAL_CCB_ERROR_SAES_RCC_RESET
#define HAL_CCB_ERROR_PKA_RCC_RESET
#define HAL_CCB_ERROR_RNG_RCC_RESET
#define HAL_CCB_ERROR_CCB_CLOCK_GATED
#define HAL_CCB_ERROR_SAES_CLOCK_GATED
#define HAL_CCB_ERROR_PKA_CLOCK_GATED
#define HAL_CCB_ERROR_RNG_CLOCK_GATED
#define HAL_CCB_ERROR_SAES_IV1_TRIVIAL
#define HAL_CCB_ERROR_SAES_IV2_TRIVIAL
#define HAL_CCB_ERROR_SAES_IV3_TRIVIAL
#define HAL_CCB_ERROR_SAES_GCM_TAG_FAIL
.
#define HAL_CCB_ERROR_SAES_KEYSIZE_INVALID
#define HAL_CCB_ERROR_SAES_CHMOD_INVALID
#define HAL_CCB_ERROR_SAES_KMOD_INVALID
#define HAL_CCB_ERROR_SAES_KEYSEL_INVALID
#define HAL_CCB_ERROR_SAES_GCMPH_INVALID
#define HAL_CCB_ERROR_SAES_MODE_MISMATCH
#define HAL_CCB_ERROR_SAES_BUSY
#define HAL_CCB_ERROR_PKA_EN_INVALID
#define HAL_CCB_ERROR_PKA_INITOK_INVALID
#define HAL_CCB_ERROR_AHB
#define HAL_CCB_ERROR_PKA_LMF_SET
#define HAL_CCB_ERROR_REFTAG_ZERO
#define HAL_CCB_ERROR_SECURITY_PROTECTION
#define HAL_CCB_ERROR_PKA_MODE_MISMATCH
.
.
.
#define HAL_CCB_ERROR_EVENT_ENDSTEP_0
#define HAL_CCB_ERROR_EVENT_ENDSTEP_1
#define HAL_CCB_ERROR_EVENT_ENDSTEP_2
#define HAL_CCB_ERROR_EVENT_ENDSTEP_3
#define HAL_CCB_ERROR_EVENT_ENDSTEP_A
#define HAL_CCB_ERROR_EVENT_ENDSTEP_12
#define HAL_CCB_ERROR_EVENT_ENDSTEP_13
#define HAL_CCB_ERROR_EVENT_ENDSTEP_17
|
HAL CCB state constants ¶
|
HAL1 |
HAL2 |
|---|---|
#define HAL_CCB_STATE_RESET
#define HAL_CCB_STATE_READY
#define HAL_CCB_STATE_BUSY
#define HAL_CCB_STATE_ERROR
|
typedef enum
{
HAL_CCB_STATE_RESET,
HAL_CCB_STATE_IDLE,
HAL_CCB_STATE_ACTIVE,
HAL_CCB_STATE_FAULT
} hal_ccb_state_t;
|
Related concepts:
Replace Finite Parameter Defines (Including PPP Instances) with Enum Types at HAL Levels.
Add HAL_PPP Prefix to All HAL Peripheral APIs (Defines, Macros, Types, and Functions).
HAL CCB user key constants ¶
|
HAL1 |
HAL2 |
|---|---|
|
In HAL1,
#define HAL_CCB_USER_KEY_WRAPPED
|
In HAL2, dedicated software wrap private key functions are used to wrap the private key with a user key. |
Example usage ¶
|
HAL1 |
HAL2 |
|---|---|
/* Configure Wrapped Key */
wrappedKeyConf.WrappingKeyType = HAL_CCB_USER_KEY_WRAPPED;
wrappedKeyConf.pInitVect = AESIV;
wrappedKeyConf.AES_Algorithm = CCB_AES_CBC;
wrappedKeyConf.pUserWrappedWrappingKey = Wrapped_key_Buffer;
HAL_CCB_ECDSA_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf);
HAL_CCB_ECDSA_WrapPrivateKey(&hccb, &ECDSAparam, ecdsa192_Prvt_keyP, &wrappedKeyConf, &ECDSAKeyBlob);
|
/* Configure Wrapped Key */
wrappedKeyConf.p_init_vect = AESIV;
wrappedKeyConf.aes_algorithm = HAL_CCB_AES_CBC;
wrappedKeyConf.key_size = 256;
HAL_CCB_ECDSA_WrapSymmetricKey(&hccb, Symetric_AESKey256, &wrappedKeyConf, Wrapped_key_Buffer);
HAL_CCB_ECDSA_SW_WrapPrivateKey(&hccb, &ECDSAparam, ecdsa192_Prvt_keyP, &wrappedKeyConf, Wrapped_key_Buffer, &ECDSAKeyBlob);
|
|
HAL1 |
HAL2 |
|---|---|
#define HAL_CCB_USER_KEY_HW
#define HAL_CCB_USER_KEY_HSW
|
typedef enum
{
HAL_CCB_KEY_HW,
HAL_CCB_KEY_HSW
} hal_ccb_wrapping_hw_key_type_t;
|
Related concepts: